<?php

namespace App\Policies;

use App\Models\PatentEvaluate;
use App\Models\AdminUser;
use App\PatentApply;

class PatentApplyPolicy
{
    public function edit(AdminUser $user, PatentApply $model)
    {
        return $user->role_typ == 1 || ($model['user_id'] == $user->id && $model['review_status'] != 1);
    }

    public function update(AdminUser $user, PatentApply $model)
    {
        return $user->role_typ == 1 || ($model['user_id'] == $user->id && $model['review_status'] != 1);
    }

    public function delete(AdminUser $user, PatentApply $model)
    {
        return $user->role_typ == 1 || ($model['user_id'] == $user->id && $model['review_status'] != 1);
    }

    //上传证书
    public function certificate(AdminUser $user, PatentApply $model)
    {
        return $user['role_type'] == 1 || ($model['user_id'] == $user['id'] && $model['review_status'] == 1);
    }
}
